// Button.h
//
// A class for GUI buttons
//
// Nick Kitten
// 2009

#pragma once

#include "DarkGDK.h"
#include "Utilities.h"
#include "Object.h"
#include "ImageUtils.h"

#define TEMP_BITMAP 31
#define SCALED_BITMAP 30


class Button
{
public:
	Button( char * spriteFile, int ID, char * text, int x, int y, void (*leftCallback)(), 
		void (*rightCallback)() = 0, int width = -1, int height = -1 );
	~Button();

	// Calls callback function
	void click();

	// Draws the button to the current bitmap surface
	void display();

	void setVisible( bool visibility );
	bool getVisible() const;

	int getID() const;

	// Checks if the pixel is within the hit area of the button
	bool inRect( int x, int y ) const;

protected:
	// Stores the rectangle used to check whether the button has been clicked
	Rect hitBox;
	bool visible;
	int id;
	int lastPressed;
	int buttonPressed;
	void (*leftClickFunc)();
	void (*rightClickFunc)();
};